
drop _all

* First import the data set DATA_AydoganBergerBosetti.dta

*********************************************************** 

* CE1: R
* CE2: CR25
* CE3: CR0
* CE4: MA25
* CE5: MA0
* CE9: E

***** Compute Premia relative to simple risk *******

generate double P_CR25=(CE1-CE2)/max(CE1, CE2)
generate double P_CR0=(CE1-CE3)/max(CE1, CE3)
generate double P_MA25=(CE1-CE4)/max(CE1, CE4)
generate double P_MA0=(CE1-CE5)/max(CE1, CE5)
generate double P_E=(CE1-CE9)/max(CE1, CE9)

*****************************************************

***************** Notes for replicators ***********************

* For the count of inconsistent patterns in the choice list, run lines 37-77

* For reproducing the results in Table 1, run lines 77-104

* For reproducing the results in Table 2, run lines 105-125

* For reproducing the results in Table 3, run lines 126-175

* For reproducing the results in Table 4, run lines 176-212


*******************************************************
* Count inconsistent observations (multiple-, reverse- or no-switching patterns in choice lists)
*******************************************************

* Inconsistent or not, for R
generate incons1=0
replace incons1=1 if CE1==.

* Inconsistent or not, for CR25
generate incons2=0
replace incons2=1 if CE2==.

* Inconsistent or not, for CR0
generate incons3=0
replace incons3=1 if CE3==.

* Inconsistent or not, for MA25
generate incons4=0
replace incons4=1 if CE4==.

* Inconsistent or not, for MA0
generate incons5=0
replace incons5=1 if CE5==.

* Inconsistent or not, for E
generate incons6=0
replace incons6=1 if CE9==.

* Sum up the number of inconsistent patterns (out of 6) for each subject 
generate incons_total=incons1+incons2+incons3+incons4+incons5+incons6

* Statistics in Footnote 13 
tabulate incons_total Actuaries
* 13 out of 125 students (first column), and 10 out of 84 actuaries (second column) had inconsistency in at least one choice list
* 4 actuaries had inconsistency in all choice lists

* two-sample Z-test of proportions
prtesti 125 13 84 10, count  



*******************************************************
* Table 1: Average Premia Relative to Risk
*******************************************************

* Actuaries
ttest P_CR0=0 if Actuaries==1
ttest P_CR25=0 if Actuaries==1
ttest P_MA0=0 if Actuaries==1
ttest P_MA25=0 if Actuaries==1
ttest P_E=0 if Actuaries==1

* Students
ttest P_CR0=0 if Actuaries==0
ttest P_CR25=0 if Actuaries==0
ttest P_MA0=0 if Actuaries==0
ttest P_MA25=0 if Actuaries==0
ttest P_E=0 if Actuaries==0

* Two-sample tests
ttest P_CR0, by(Actuaries)
ttest P_CR25, by(Actuaries)
ttest P_MA0, by(Actuaries)
ttest P_MA25, by(Actuaries)
ttest P_E, by(Actuaries)




*******************************************************
* Table 2: Pearson Correlations Between Compound Risk and Ambiguity Premium
*******************************************************

*** Actuaries

* Correlation of CR0 with ambiguous sources (look at the first column)
pwcorr P_CR0 P_MA0 P_MA25 P_E if Actuaries==1, sig
* Correlation of CR25 with ambiguous sources (look at the first column)
pwcorr P_CR25 P_MA0 P_MA25 P_E if Actuaries==1, sig

*** Students

* Correlation of CR0 with ambiguous sources (here the first column)
pwcorr P_CR0 P_MA0 P_MA25 P_E if Actuaries==0, sig
* Correlation of CR25 with ambiguous sources (here the first column)
pwcorr P_CR25 P_MA0 P_MA25 P_E if Actuaries==0, sig




*******************************************************
* Table 3: Random Effects Regressions of Relative Premia
*******************************************************

* First prepare the data for the long format

generate double P1=P_CR25
generate double P2=P_CR0
generate double P3=P_MA25
generate double P4=P_MA0

* Reshape the data into the long format
reshape long P, i(ID) j(Source)

* generate dummy for sophistication (=1 if actuaries)
generate double Soph=Actuaries

* generate dummy for complexity (=1 if CR25 or MA25)
generate COMPLEX=.
replace COMPLEX=0 if Source==2 | Source==4
replace COMPLEX=1 if Source==1 | Source==3

* generate dummy for ambiguity (=1 if MA0 or MA25)
generate AMBIGOUS=.
replace AMBIGOUS=0 if Source==1 | Source==2
replace AMBIGOUS=1 if Source==3 | Source==4

*** Regression for actuaries
xtreg  P i.COMPLEX##i.AMBIGOUS if Actuaries==1, vce(cluster ID) i(ID) re 
estimates store Actuaries

*** Regression for students
xtreg  P i.COMPLEX##i.AMBIGOUS if Actuaries==0, vce(cluster ID) i(ID) re 
estimates store Students

*** Pooled regression to test the effect of sophistication
xtreg  P COMPLEX##AMBIGOUS##Soph, cluster(ID) i(ID) re
estimates store Pooled

*** Reconstruct Table 3
esttab Actuaries Students Pooled, mti se scalars(N R2) label

* reshape the data into wide form
drop COMPLEX AMBIGOUS Soph
drop _est_Actuaries _est_Students _est_Pooled
reshape wide P, i(ID) j(Source)




*******************************************************
* Table 4: OLS Regressions of Ellsberg Ambiguity Premium
*******************************************************

* Define model uncertainty attitude
generate double MU_A=P_MA0-P_CR0

* Define complexity attitude
generate double c_A=P_CR25-P_CR0

* Define reduction dummy
generate double red=0
replace red=1 if P_CR0!=0
replace red=. if P_CR0==.

* generate dummy for sophistication (=1 if Actuaries)
generate double Sophistication=Actuaries

* Regression for actuaries
regress P_E c_A MU_A red  if Actuaries==1, vce(robust)
estimates store Actuaries

* Regression for students
regress P_E  c_A MU_A red  if Actuaries==0, vce(robust)
estimates store Students

* Pooled regression to test differences between groups
regress P_E i.Soph##c.c_A i.Soph##c.MU_A i.Soph##i.red, vce(robust) 
estimates store Pooled

* Reconstruct Table 4
esttab Actuaries Students Pooled, mti se scalars(N R2) label

******************************************************

